package com.hongyue.dey05;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class fuwuqi {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(9527);
        Socket a = ss.accept();
        InputStream is = a.getInputStream();
        InetAddress ia = a.getInetAddress();
        System.out.println(ia.getAddress());
        System.out.println(ia.getHostName());
        byte[] bys = new byte[1024];
        for (int i; (i = is.read(bys)) != -1; ) {
            System.out.println(new String(bys, 0, i));
        }
        OutputStream os = a.getOutputStream();
        os.write("接受文件成功".getBytes());
    }
}
